home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Technotools
/
Technotools (Chestnut CD-ROM)(1993).ISO
/
lang_c
/
mixisam
/
istest3.c
< prev
next >
Wrap
C/C++ Source or Header
|
1991-10-16
|
2KB
|
74 lines
/* ISAM Test Program #3, by Ron Ruffin. This program will test our edit
library functions, and will use the database created in the first istest
program. */
#include "rarisam.c"
char name[21] = " ";
char phone_area[4] = " ";
char phone_exchange[4] = " ";
char phone_body[5] = " ";
Db_Obj *phone_database;
Index_Obj *phone_index;
char *phone_format[] = {
"name",
"area code",
"exchange",
"body number",
NULL
};
char *phone_index_format[] = {
"name",
NULL
};
main()
{
isam_open(&phone_database, "phone", &phone_index, "name");
isam_search(phone_database, phone_index, "Dean");
move_data_to_fields();
clear_screen();
display_field(5, 0, 8, "NAME ", &name, NON_KEY);
display_field(6, 0, 3, "PHONE ", &phone_area, NON_KEY);
display_field(6, 9, 3, "-", &phone_exchange, NON_KEY);
display_field(6, 13, 4, "-", &phone_body, NON_KEY);
edit_screen_data(KEY_YES);
clear_screen();
printf("NAME %s, PHONE %s-%s-%s\n",name, phone_area, phone_exchange, phone_body);
isam_close(phone_database);
}
move_data_to_fields()
{
strcpy(name, *(fields + 0));
strcpy(phone_area, *(fields + 1));
strcpy(phone_exchange, *(fields + 2));
strcpy(phone_body, *(fields + 3));
}
test_edit_array()
/* This temporary function provides a test which prints out the edit_array
values. It is intended for use after all the display_field commands have
been issued. */
{
int array_element;
FILE *printer_file;
printer_file = fopen("lpt1", "w");
fprintf(printer_file, " edit_array values\n\n");
fprintf(printer_file, " Start row Start col Length Address \
Key status\n");
for (array_element = 0; array_element < 20; array_element++) {
fprintf(printer_file, " %d %d %d %d \
%d\n", edit_array [array_element] [0], edit_array [array_element] [1],
edit_array [array_element] [2], edit_array [array_element] [3],
edit_array [array_element] [4]);
};
fprintf(printer_file, " current_edit_field = %d\n",
current_edit_field);
fprintf(printer_file, "\f");
fclose(printer_file);
}